<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use backend\models\Donor;

/* @var $this yii\web\View */
/* @var $model backend\models\Donor */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="create-form donor-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>

    <h1 class="main-title">Договор сотрудничества</h1>
    <div class="row">
        <?= $form->field($model, 'coop_contract_date_sign', ['options' => ['class' => 'col-sm-4']])->input('date')  ?>
        <?= $form->field($model, 'coop_contract_date_end', ['options' => ['class' => 'col-sm-4']])->input('date') ?>
    </div>
    <?= $form->field($model, 'coop_contract_subject')->textarea(['rows' => 6]) ?>
    <div class="row">
        <?= $form->field($model, 'docCoopContract', ['options' => ['class' => 'col-sm-4']])->fileInput(['accept' => '.doc,.docx,.pdf']) ?>
        <div class="col-sm-8">
            <?php 
            if(!empty($model->coop_contract_filename))
            {
                echo '<label class="control-label">Договор сотрудничества</label>';
                echo '<div class="anchor-container">';
                echo Html::a($model->coop_contract_filename, 'https://storage.yandexcloud.net/' . Donor::BUCKET_NAME  . '/' . $model->coop_contract_filename);
                echo '</div>';
            }
            ?>
        </div>
    </div>

    <div class="form-group">
        <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
